package org.com.coolfish.listener;


import org.com.coolfish.common.message.MsisdnCardMessage;
import org.com.coolfish.service.CUCCCardStopService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
@Component
@RabbitListener(queues = "cucc-stop-queue")
public class CUCCMessageListener {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	private MsisdnCardMessage msisdnCardMessage;
	@Autowired
    private CUCCCardStopService cuccCardStopService;

 	

	@RabbitHandler
    public void onMessage(String message) {
		
		// 将String 转为MsisdnMessage对象
        logger.info("停机队列(ctcc-stop)获取数据[{}]", message);
        msisdnCardMessage = JSON.parseObject(message, MsisdnCardMessage.class);
        
        cuccCardStopService.handle(msisdnCardMessage);
	}
	
	
}
